class EmployeesController < ApplicationController
  respond_to :json
  load_resource

  # paginate
  def index
    render json: Employee.all(params[:page]||1)
  end

  def certificates
    render json: EmployeeCertificateJsonSerializer.index_json(@employee.employee_certificates)
  end

  def show
    render json: EmployeeJsonSerializer.as_json(@employee)
  end

  def positions
    render json: @employee["positions"]
  end

  def position_lost_certificates
    respond_with EmployeePosition.check_certificate @employee
  end

  def contracts
    render json: ContractQuery.query_by_employee(@employee)
  end

  private
  def permitted_params
    params.permit(:employee => [:name, :erp_id])
  end

end
